--
-- PostgreSQL database dump
--

-- Dumped from database version 9.0.4
-- Dumped by pg_dump version 9.0.3
-- Started on 2011-09-26 11:42:57

SET statement_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = off;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET escape_string_warning = off;

--
-- TOC entry 1919 (class 1262 OID 16384)
-- Name: gestion_canchas; Type: DATABASE; Schema: -; Owner: postgres
--

CREATE DATABASE gestion_canchas WITH TEMPLATE = template0 ENCODING = 'UTF8' LC_COLLATE = 'Spanish_Argentina.1252' LC_CTYPE = 'Spanish_Argentina.1252';


ALTER DATABASE gestion_canchas OWNER TO postgres;

\connect gestion_canchas

SET statement_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = off;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET escape_string_warning = off;

--
-- TOC entry 347 (class 2612 OID 11574)
-- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: -; Owner: postgres
--

CREATE OR REPLACE PROCEDURAL LANGUAGE plpgsql;


ALTER PROCEDURAL LANGUAGE plpgsql OWNER TO postgres;

SET search_path = public, pg_catalog;

SET default_tablespace = '';

SET default_with_oids = false;

--
-- TOC entry 1549 (class 1259 OID 16578)
-- Dependencies: 1849 6
-- Name: alquiler; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE alquiler (
    alquiler_id integer NOT NULL,
    fecha timestamp without time zone NOT NULL,
    hora_comienzo time without time zone NOT NULL,
    hora_fin time without time zone NOT NULL,
    estado integer NOT NULL,
    sucursales_id integer NOT NULL,
    clientes_id integer NOT NULL,
    canchas_id integer NOT NULL,
    fecha_hora timestamp with time zone DEFAULT now()
);


ALTER TABLE public.alquiler OWNER TO postgres;

--
-- TOC entry 1550 (class 1259 OID 16582)
-- Dependencies: 1549 6
-- Name: alquiler_alquiler_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE alquiler_alquiler_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.alquiler_alquiler_id_seq OWNER TO postgres;

--
-- TOC entry 1922 (class 0 OID 0)
-- Dependencies: 1550
-- Name: alquiler_alquiler_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE alquiler_alquiler_id_seq OWNED BY alquiler.alquiler_id;


--
-- TOC entry 1923 (class 0 OID 0)
-- Dependencies: 1550
-- Name: alquiler_alquiler_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('alquiler_alquiler_id_seq', 1, false);


--
-- TOC entry 1539 (class 1259 OID 16548)
-- Dependencies: 6
-- Name: canchas; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE canchas (
    canchas_id integer NOT NULL,
    descripcion character varying(50),
    sucursales_id integer NOT NULL
);


ALTER TABLE public.canchas OWNER TO postgres;

--
-- TOC entry 1540 (class 1259 OID 16551)
-- Dependencies: 6 1539
-- Name: canchas_canchas_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE canchas_canchas_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.canchas_canchas_id_seq OWNER TO postgres;

--
-- TOC entry 1924 (class 0 OID 0)
-- Dependencies: 1540
-- Name: canchas_canchas_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE canchas_canchas_id_seq OWNED BY canchas.canchas_id;


--
-- TOC entry 1925 (class 0 OID 0)
-- Dependencies: 1540
-- Name: canchas_canchas_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('canchas_canchas_id_seq', 1, false);


--
-- TOC entry 1541 (class 1259 OID 16553)
-- Dependencies: 6
-- Name: clientes; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE clientes (
    clientes_id integer NOT NULL,
    apellido character varying(100) NOT NULL,
    nombre character varying(100) NOT NULL,
    dni character varying(8) NOT NULL,
    telefono character varying(30) NOT NULL,
    domicilio character varying(150),
    email character varying(30) NOT NULL
);


ALTER TABLE public.clientes OWNER TO postgres;

--
-- TOC entry 1542 (class 1259 OID 16556)
-- Dependencies: 6 1541
-- Name: clientes_clientes_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE clientes_clientes_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.clientes_clientes_id_seq OWNER TO postgres;

--
-- TOC entry 1926 (class 0 OID 0)
-- Dependencies: 1542
-- Name: clientes_clientes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE clientes_clientes_id_seq OWNED BY clientes.clientes_id;


--
-- TOC entry 1927 (class 0 OID 0)
-- Dependencies: 1542
-- Name: clientes_clientes_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('clientes_clientes_id_seq', 1, false);


--
-- TOC entry 1556 (class 1259 OID 16669)
-- Dependencies: 6
-- Name: cuentas_contables; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE cuentas_contables (
    cuentas_contables_id integer NOT NULL,
    descripcion character varying(50) NOT NULL,
    tipo character varying(10) NOT NULL
);


ALTER TABLE public.cuentas_contables OWNER TO postgres;

--
-- TOC entry 1555 (class 1259 OID 16667)
-- Dependencies: 1556 6
-- Name: cuentas_contables_cuentas_contables_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE cuentas_contables_cuentas_contables_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.cuentas_contables_cuentas_contables_id_seq OWNER TO postgres;

--
-- TOC entry 1928 (class 0 OID 0)
-- Dependencies: 1555
-- Name: cuentas_contables_cuentas_contables_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE cuentas_contables_cuentas_contables_id_seq OWNED BY cuentas_contables.cuentas_contables_id;


--
-- TOC entry 1929 (class 0 OID 0)
-- Dependencies: 1555
-- Name: cuentas_contables_cuentas_contables_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('cuentas_contables_cuentas_contables_id_seq', 1, false);


--
-- TOC entry 1560 (class 1259 OID 16686)
-- Dependencies: 6
-- Name: detalle_movimientos; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE detalle_movimientos (
    detalle_movimientos_id integer NOT NULL,
    productos_id integer NOT NULL,
    cantidad integer NOT NULL,
    subtotal double precision NOT NULL,
    movimientos_id integer NOT NULL
);


ALTER TABLE public.detalle_movimientos OWNER TO postgres;

--
-- TOC entry 1559 (class 1259 OID 16684)
-- Dependencies: 6 1560
-- Name: detalle_movimientos_detalle_movimientos_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE detalle_movimientos_detalle_movimientos_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.detalle_movimientos_detalle_movimientos_id_seq OWNER TO postgres;

--
-- TOC entry 1930 (class 0 OID 0)
-- Dependencies: 1559
-- Name: detalle_movimientos_detalle_movimientos_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE detalle_movimientos_detalle_movimientos_id_seq OWNED BY detalle_movimientos.detalle_movimientos_id;


--
-- TOC entry 1931 (class 0 OID 0)
-- Dependencies: 1559
-- Name: detalle_movimientos_detalle_movimientos_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('detalle_movimientos_detalle_movimientos_id_seq', 1, false);


--
-- TOC entry 1554 (class 1259 OID 16660)
-- Dependencies: 6
-- Name: empleados; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE empleados (
    empleados_id integer NOT NULL,
    apellido character varying(100) NOT NULL,
    nombre character varying(100) NOT NULL,
    dni character varying(8) NOT NULL,
    telefono character varying(30) NOT NULL,
    domicilio character varying(150) NOT NULL,
    localidades_id integer NOT NULL,
    provincias_id integer NOT NULL,
    email character varying(30) NOT NULL,
    fecha_nacimiento date NOT NULL,
    sucursales_id integer NOT NULL,
    usuarios_id integer NOT NULL
);


ALTER TABLE public.empleados OWNER TO postgres;

--
-- TOC entry 1553 (class 1259 OID 16658)
-- Dependencies: 1554 6
-- Name: empleados_empleados_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE empleados_empleados_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.empleados_empleados_id_seq OWNER TO postgres;

--
-- TOC entry 1932 (class 0 OID 0)
-- Dependencies: 1553
-- Name: empleados_empleados_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE empleados_empleados_id_seq OWNED BY empleados.empleados_id;


--
-- TOC entry 1933 (class 0 OID 0)
-- Dependencies: 1553
-- Name: empleados_empleados_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('empleados_empleados_id_seq', 1, false);


--
-- TOC entry 1543 (class 1259 OID 16563)
-- Dependencies: 6
-- Name: estados; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE estados (
    estados_id integer NOT NULL,
    descripcion character varying(50) NOT NULL
);


ALTER TABLE public.estados OWNER TO postgres;

--
-- TOC entry 1544 (class 1259 OID 16566)
-- Dependencies: 1543 6
-- Name: estados_estados_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE estados_estados_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.estados_estados_id_seq OWNER TO postgres;

--
-- TOC entry 1934 (class 0 OID 0)
-- Dependencies: 1544
-- Name: estados_estados_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE estados_estados_id_seq OWNED BY estados.estados_id;


--
-- TOC entry 1935 (class 0 OID 0)
-- Dependencies: 1544
-- Name: estados_estados_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('estados_estados_id_seq', 1, false);


--
-- TOC entry 1566 (class 1259 OID 16710)
-- Dependencies: 6
-- Name: localidades; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE localidades (
    localidades_id integer NOT NULL,
    descripcion character varying(100) NOT NULL,
    provincias_id integer NOT NULL
);


ALTER TABLE public.localidades OWNER TO postgres;

--
-- TOC entry 1565 (class 1259 OID 16708)
-- Dependencies: 6 1566
-- Name: localidades_localidades_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE localidades_localidades_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.localidades_localidades_id_seq OWNER TO postgres;

--
-- TOC entry 1936 (class 0 OID 0)
-- Dependencies: 1565
-- Name: localidades_localidades_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE localidades_localidades_id_seq OWNED BY localidades.localidades_id;


--
-- TOC entry 1937 (class 0 OID 0)
-- Dependencies: 1565
-- Name: localidades_localidades_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('localidades_localidades_id_seq', 1, false);


--
-- TOC entry 1558 (class 1259 OID 16677)
-- Dependencies: 1855 6
-- Name: movimientos; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE movimientos (
    movimientos_id integer NOT NULL,
    total double precision NOT NULL,
    cuentas_contables_id integer NOT NULL,
    usuarios_id integer NOT NULL,
    fecha_hora timestamp with time zone DEFAULT now()
);


ALTER TABLE public.movimientos OWNER TO postgres;

--
-- TOC entry 1557 (class 1259 OID 16675)
-- Dependencies: 1558 6
-- Name: movimientos_movimientos_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE movimientos_movimientos_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.movimientos_movimientos_id_seq OWNER TO postgres;

--
-- TOC entry 1938 (class 0 OID 0)
-- Dependencies: 1557
-- Name: movimientos_movimientos_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE movimientos_movimientos_id_seq OWNED BY movimientos.movimientos_id;


--
-- TOC entry 1939 (class 0 OID 0)
-- Dependencies: 1557
-- Name: movimientos_movimientos_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('movimientos_movimientos_id_seq', 1, false);


--
-- TOC entry 1545 (class 1259 OID 16568)
-- Dependencies: 6
-- Name: perfiles; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE perfiles (
    perfiles_id integer NOT NULL,
    descripcion character varying(30) NOT NULL
);


ALTER TABLE public.perfiles OWNER TO postgres;

--
-- TOC entry 1546 (class 1259 OID 16571)
-- Dependencies: 1545 6
-- Name: perfiles_perfiles_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE perfiles_perfiles_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.perfiles_perfiles_id_seq OWNER TO postgres;

--
-- TOC entry 1940 (class 0 OID 0)
-- Dependencies: 1546
-- Name: perfiles_perfiles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE perfiles_perfiles_id_seq OWNED BY perfiles.perfiles_id;


--
-- TOC entry 1941 (class 0 OID 0)
-- Dependencies: 1546
-- Name: perfiles_perfiles_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('perfiles_perfiles_id_seq', 1, false);


--
-- TOC entry 1562 (class 1259 OID 16694)
-- Dependencies: 6
-- Name: productos; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE productos (
    productos_id integer NOT NULL,
    descripcion character varying(100) NOT NULL,
    precio_unitario double precision NOT NULL,
    stock integer NOT NULL
);


ALTER TABLE public.productos OWNER TO postgres;

--
-- TOC entry 1561 (class 1259 OID 16692)
-- Dependencies: 1562 6
-- Name: productos_productos_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE productos_productos_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.productos_productos_id_seq OWNER TO postgres;

--
-- TOC entry 1942 (class 0 OID 0)
-- Dependencies: 1561
-- Name: productos_productos_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE productos_productos_id_seq OWNED BY productos.productos_id;


--
-- TOC entry 1943 (class 0 OID 0)
-- Dependencies: 1561
-- Name: productos_productos_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('productos_productos_id_seq', 1, false);


--
-- TOC entry 1564 (class 1259 OID 16702)
-- Dependencies: 6
-- Name: provincias; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE provincias (
    provincias_id integer NOT NULL,
    descripcion character varying(50) NOT NULL
);


ALTER TABLE public.provincias OWNER TO postgres;

--
-- TOC entry 1563 (class 1259 OID 16700)
-- Dependencies: 1564 6
-- Name: provincias_provincias_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE provincias_provincias_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.provincias_provincias_id_seq OWNER TO postgres;

--
-- TOC entry 1944 (class 0 OID 0)
-- Dependencies: 1563
-- Name: provincias_provincias_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE provincias_provincias_id_seq OWNED BY provincias.provincias_id;


--
-- TOC entry 1945 (class 0 OID 0)
-- Dependencies: 1563
-- Name: provincias_provincias_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('provincias_provincias_id_seq', 1, false);


--
-- TOC entry 1547 (class 1259 OID 16573)
-- Dependencies: 6
-- Name: sucursales; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE sucursales (
    sucursales_id integer NOT NULL,
    descripcion character varying(100) NOT NULL,
    domicilio character varying(150) NOT NULL,
    localidades_id integer NOT NULL,
    provincias_id integer NOT NULL,
    telefono character varying(30) NOT NULL
);


ALTER TABLE public.sucursales OWNER TO postgres;

--
-- TOC entry 1548 (class 1259 OID 16576)
-- Dependencies: 1547 6
-- Name: sucursales_sucursales_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE sucursales_sucursales_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.sucursales_sucursales_id_seq OWNER TO postgres;

--
-- TOC entry 1946 (class 0 OID 0)
-- Dependencies: 1548
-- Name: sucursales_sucursales_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE sucursales_sucursales_id_seq OWNED BY sucursales.sucursales_id;


--
-- TOC entry 1947 (class 0 OID 0)
-- Dependencies: 1548
-- Name: sucursales_sucursales_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('sucursales_sucursales_id_seq', 1, false);


--
-- TOC entry 1551 (class 1259 OID 16584)
-- Dependencies: 6
-- Name: usuarios; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE usuarios (
    usuarios_id integer NOT NULL,
    username character varying(50) NOT NULL,
    password character varying(50) NOT NULL,
    habilitado integer NOT NULL,
    perfiles_id integer NOT NULL
);


ALTER TABLE public.usuarios OWNER TO postgres;

--
-- TOC entry 1552 (class 1259 OID 16587)
-- Dependencies: 6 1551
-- Name: usuarios_usuarios_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE usuarios_usuarios_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.usuarios_usuarios_id_seq OWNER TO postgres;

--
-- TOC entry 1948 (class 0 OID 0)
-- Dependencies: 1552
-- Name: usuarios_usuarios_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE usuarios_usuarios_id_seq OWNED BY usuarios.usuarios_id;


--
-- TOC entry 1949 (class 0 OID 0)
-- Dependencies: 1552
-- Name: usuarios_usuarios_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('usuarios_usuarios_id_seq', 1, false);


--
-- TOC entry 1850 (class 2604 OID 16595)
-- Dependencies: 1550 1549
-- Name: alquiler_id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE alquiler ALTER COLUMN alquiler_id SET DEFAULT nextval('alquiler_alquiler_id_seq'::regclass);


--
-- TOC entry 1844 (class 2604 OID 16589)
-- Dependencies: 1540 1539
-- Name: canchas_id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE canchas ALTER COLUMN canchas_id SET DEFAULT nextval('canchas_canchas_id_seq'::regclass);


--
-- TOC entry 1845 (class 2604 OID 16590)
-- Dependencies: 1542 1541
-- Name: clientes_id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE clientes ALTER COLUMN clientes_id SET DEFAULT nextval('clientes_clientes_id_seq'::regclass);


--
-- TOC entry 1853 (class 2604 OID 16672)
-- Dependencies: 1556 1555 1556
-- Name: cuentas_contables_id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE cuentas_contables ALTER COLUMN cuentas_contables_id SET DEFAULT nextval('cuentas_contables_cuentas_contables_id_seq'::regclass);


--
-- TOC entry 1856 (class 2604 OID 16689)
-- Dependencies: 1560 1559 1560
-- Name: detalle_movimientos_id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE detalle_movimientos ALTER COLUMN detalle_movimientos_id SET DEFAULT nextval('detalle_movimientos_detalle_movimientos_id_seq'::regclass);


--
-- TOC entry 1852 (class 2604 OID 16663)
-- Dependencies: 1553 1554 1554
-- Name: empleados_id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE empleados ALTER COLUMN empleados_id SET DEFAULT nextval('empleados_empleados_id_seq'::regclass);


--
-- TOC entry 1846 (class 2604 OID 16592)
-- Dependencies: 1544 1543
-- Name: estados_id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE estados ALTER COLUMN estados_id SET DEFAULT nextval('estados_estados_id_seq'::regclass);


--
-- TOC entry 1859 (class 2604 OID 16713)
-- Dependencies: 1565 1566 1566
-- Name: localidades_id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE localidades ALTER COLUMN localidades_id SET DEFAULT nextval('localidades_localidades_id_seq'::regclass);


--
-- TOC entry 1854 (class 2604 OID 16680)
-- Dependencies: 1557 1558 1558
-- Name: movimientos_id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE movimientos ALTER COLUMN movimientos_id SET DEFAULT nextval('movimientos_movimientos_id_seq'::regclass);


--
-- TOC entry 1847 (class 2604 OID 16593)
-- Dependencies: 1546 1545
-- Name: perfiles_id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE perfiles ALTER COLUMN perfiles_id SET DEFAULT nextval('perfiles_perfiles_id_seq'::regclass);


--
-- TOC entry 1857 (class 2604 OID 16697)
-- Dependencies: 1562 1561 1562
-- Name: productos_id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE productos ALTER COLUMN productos_id SET DEFAULT nextval('productos_productos_id_seq'::regclass);


--
-- TOC entry 1858 (class 2604 OID 16705)
-- Dependencies: 1564 1563 1564
-- Name: provincias_id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE provincias ALTER COLUMN provincias_id SET DEFAULT nextval('provincias_provincias_id_seq'::regclass);


--
-- TOC entry 1848 (class 2604 OID 16594)
-- Dependencies: 1548 1547
-- Name: sucursales_id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE sucursales ALTER COLUMN sucursales_id SET DEFAULT nextval('sucursales_sucursales_id_seq'::regclass);


--
-- TOC entry 1851 (class 2604 OID 16596)
-- Dependencies: 1552 1551
-- Name: usuarios_id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE usuarios ALTER COLUMN usuarios_id SET DEFAULT nextval('usuarios_usuarios_id_seq'::regclass);


--
-- TOC entry 1908 (class 0 OID 16578)
-- Dependencies: 1549
-- Data for Name: alquiler; Type: TABLE DATA; Schema: public; Owner: postgres
--



--
-- TOC entry 1903 (class 0 OID 16548)
-- Dependencies: 1539
-- Data for Name: canchas; Type: TABLE DATA; Schema: public; Owner: postgres
--



--
-- TOC entry 1904 (class 0 OID 16553)
-- Dependencies: 1541
-- Data for Name: clientes; Type: TABLE DATA; Schema: public; Owner: postgres
--



--
-- TOC entry 1911 (class 0 OID 16669)
-- Dependencies: 1556
-- Data for Name: cuentas_contables; Type: TABLE DATA; Schema: public; Owner: postgres
--



--
-- TOC entry 1913 (class 0 OID 16686)
-- Dependencies: 1560
-- Data for Name: detalle_movimientos; Type: TABLE DATA; Schema: public; Owner: postgres
--



--
-- TOC entry 1910 (class 0 OID 16660)
-- Dependencies: 1554
-- Data for Name: empleados; Type: TABLE DATA; Schema: public; Owner: postgres
--



--
-- TOC entry 1905 (class 0 OID 16563)
-- Dependencies: 1543
-- Data for Name: estados; Type: TABLE DATA; Schema: public; Owner: postgres
--



--
-- TOC entry 1916 (class 0 OID 16710)
-- Dependencies: 1566
-- Data for Name: localidades; Type: TABLE DATA; Schema: public; Owner: postgres
--



--
-- TOC entry 1912 (class 0 OID 16677)
-- Dependencies: 1558
-- Data for Name: movimientos; Type: TABLE DATA; Schema: public; Owner: postgres
--



--
-- TOC entry 1906 (class 0 OID 16568)
-- Dependencies: 1545
-- Data for Name: perfiles; Type: TABLE DATA; Schema: public; Owner: postgres
--



--
-- TOC entry 1914 (class 0 OID 16694)
-- Dependencies: 1562
-- Data for Name: productos; Type: TABLE DATA; Schema: public; Owner: postgres
--



--
-- TOC entry 1915 (class 0 OID 16702)
-- Dependencies: 1564
-- Data for Name: provincias; Type: TABLE DATA; Schema: public; Owner: postgres
--



--
-- TOC entry 1907 (class 0 OID 16573)
-- Dependencies: 1547
-- Data for Name: sucursales; Type: TABLE DATA; Schema: public; Owner: postgres
--



--
-- TOC entry 1909 (class 0 OID 16584)
-- Dependencies: 1551
-- Data for Name: usuarios; Type: TABLE DATA; Schema: public; Owner: postgres
--



--
-- TOC entry 1873 (class 2606 OID 16612)
-- Dependencies: 1549 1549
-- Name: alquiler_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY alquiler
    ADD CONSTRAINT alquiler_pkey PRIMARY KEY (alquiler_id);


--
-- TOC entry 1861 (class 2606 OID 16598)
-- Dependencies: 1539 1539
-- Name: canchas_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY canchas
    ADD CONSTRAINT canchas_pkey PRIMARY KEY (canchas_id);


--
-- TOC entry 1863 (class 2606 OID 16600)
-- Dependencies: 1541 1541
-- Name: clientes_dni_key; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY clientes
    ADD CONSTRAINT clientes_dni_key UNIQUE (dni);


--
-- TOC entry 1865 (class 2606 OID 16602)
-- Dependencies: 1541 1541
-- Name: clientes_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY clientes
    ADD CONSTRAINT clientes_pkey PRIMARY KEY (clientes_id);


--
-- TOC entry 1879 (class 2606 OID 16674)
-- Dependencies: 1556 1556
-- Name: cuentas_contables_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY cuentas_contables
    ADD CONSTRAINT cuentas_contables_pkey PRIMARY KEY (cuentas_contables_id);


--
-- TOC entry 1883 (class 2606 OID 16691)
-- Dependencies: 1560 1560
-- Name: detalle_movimientos_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY detalle_movimientos
    ADD CONSTRAINT detalle_movimientos_pkey PRIMARY KEY (detalle_movimientos_id);


--
-- TOC entry 1877 (class 2606 OID 16665)
-- Dependencies: 1554 1554
-- Name: empleados_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY empleados
    ADD CONSTRAINT empleados_pkey PRIMARY KEY (empleados_id);


--
-- TOC entry 1867 (class 2606 OID 16606)
-- Dependencies: 1543 1543
-- Name: estados_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY estados
    ADD CONSTRAINT estados_pkey PRIMARY KEY (estados_id);


--
-- TOC entry 1889 (class 2606 OID 16715)
-- Dependencies: 1566 1566
-- Name: localidades_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY localidades
    ADD CONSTRAINT localidades_pkey PRIMARY KEY (localidades_id);


--
-- TOC entry 1881 (class 2606 OID 16683)
-- Dependencies: 1558 1558
-- Name: movimientos_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY movimientos
    ADD CONSTRAINT movimientos_pkey PRIMARY KEY (movimientos_id);


--
-- TOC entry 1869 (class 2606 OID 16608)
-- Dependencies: 1545 1545
-- Name: perfiles_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY perfiles
    ADD CONSTRAINT perfiles_pkey PRIMARY KEY (perfiles_id);


--
-- TOC entry 1885 (class 2606 OID 16699)
-- Dependencies: 1562 1562
-- Name: productos_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY productos
    ADD CONSTRAINT productos_pkey PRIMARY KEY (productos_id);


--
-- TOC entry 1887 (class 2606 OID 16707)
-- Dependencies: 1564 1564
-- Name: provincias_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY provincias
    ADD CONSTRAINT provincias_pkey PRIMARY KEY (provincias_id);


--
-- TOC entry 1871 (class 2606 OID 16610)
-- Dependencies: 1547 1547
-- Name: sucursales_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY sucursales
    ADD CONSTRAINT sucursales_pkey PRIMARY KEY (sucursales_id);


--
-- TOC entry 1875 (class 2606 OID 16614)
-- Dependencies: 1551 1551
-- Name: usuarios_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY usuarios
    ADD CONSTRAINT usuarios_pkey PRIMARY KEY (usuarios_id);


--
-- TOC entry 1895 (class 2606 OID 16786)
-- Dependencies: 1539 1860 1549
-- Name: alquiler_canchas_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY alquiler
    ADD CONSTRAINT alquiler_canchas_id_fkey FOREIGN KEY (canchas_id) REFERENCES canchas(canchas_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- TOC entry 1894 (class 2606 OID 16781)
-- Dependencies: 1541 1549 1864
-- Name: alquiler_clientes_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY alquiler
    ADD CONSTRAINT alquiler_clientes_id_fkey FOREIGN KEY (clientes_id) REFERENCES clientes(clientes_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- TOC entry 1893 (class 2606 OID 16776)
-- Dependencies: 1549 1547 1870
-- Name: alquiler_sucursales_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY alquiler
    ADD CONSTRAINT alquiler_sucursales_id_fkey FOREIGN KEY (sucursales_id) REFERENCES sucursales(sucursales_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- TOC entry 1890 (class 2606 OID 16791)
-- Dependencies: 1547 1539 1870
-- Name: canchas_sucursales_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY canchas
    ADD CONSTRAINT canchas_sucursales_id_fkey FOREIGN KEY (sucursales_id) REFERENCES sucursales(sucursales_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- TOC entry 1901 (class 2606 OID 16801)
-- Dependencies: 1884 1562 1560
-- Name: detalle_movimientos_productos_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY detalle_movimientos
    ADD CONSTRAINT detalle_movimientos_productos_id_fkey FOREIGN KEY (productos_id) REFERENCES productos(productos_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- TOC entry 1899 (class 2606 OID 16796)
-- Dependencies: 1886 1564 1554
-- Name: empleados_provincias_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY empleados
    ADD CONSTRAINT empleados_provincias_id_fkey FOREIGN KEY (provincias_id) REFERENCES provincias(provincias_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- TOC entry 1898 (class 2606 OID 16766)
-- Dependencies: 1566 1554 1888
-- Name: localidades_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY empleados
    ADD CONSTRAINT localidades_id FOREIGN KEY (localidades_id) REFERENCES localidades(localidades_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- TOC entry 1892 (class 2606 OID 16771)
-- Dependencies: 1566 1888 1547
-- Name: localidades_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY sucursales
    ADD CONSTRAINT localidades_id FOREIGN KEY (localidades_id) REFERENCES localidades(localidades_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- TOC entry 1900 (class 2606 OID 16716)
-- Dependencies: 1560 1558 1880
-- Name: movimientos_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY detalle_movimientos
    ADD CONSTRAINT movimientos_id FOREIGN KEY (movimientos_id) REFERENCES movimientos(movimientos_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- TOC entry 1902 (class 2606 OID 16736)
-- Dependencies: 1566 1564 1886
-- Name: provincias_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY localidades
    ADD CONSTRAINT provincias_id FOREIGN KEY (provincias_id) REFERENCES provincias(provincias_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- TOC entry 1891 (class 2606 OID 16746)
-- Dependencies: 1547 1564 1886
-- Name: provincias_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY sucursales
    ADD CONSTRAINT provincias_id FOREIGN KEY (provincias_id) REFERENCES provincias(provincias_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- TOC entry 1896 (class 2606 OID 16721)
-- Dependencies: 1547 1554 1870
-- Name: sucursales_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY empleados
    ADD CONSTRAINT sucursales_id FOREIGN KEY (sucursales_id) REFERENCES sucursales(sucursales_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- TOC entry 1897 (class 2606 OID 16726)
-- Dependencies: 1554 1551 1874
-- Name: usuarios_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY empleados
    ADD CONSTRAINT usuarios_id FOREIGN KEY (usuarios_id) REFERENCES usuarios(usuarios_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- TOC entry 1921 (class 0 OID 0)
-- Dependencies: 6
-- Name: public; Type: ACL; Schema: -; Owner: postgres
--

REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM postgres;
GRANT ALL ON SCHEMA public TO postgres;
GRANT ALL ON SCHEMA public TO PUBLIC;


-- Completed on 2011-09-26 11:42:57

--
-- PostgreSQL database dump complete
--

